function SrvSql(params){ 
	 
}

SrvSql.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new SrvSql.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new SrvSql.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new SrvSql.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	
	
	/** 编号 [非空]       **/
	this.ssId=function(ssId){if(this.proxy)return this.getProxy().ssId(ssId);  this.put("ssId", ssId);return this;};
	/** and ss_id is null */
	this.ssIdNull=function(){if(this.proxy)return this.getProxy().ssIdNull();if(this.get("ssIdNot")==null)this.put("ssIdNot", "");this.put("ssId", null);return this;};
	/** not .... */
	this.ssIdNot=function(){if(this.proxy)return this.getProxy().ssIdNot();this.put("ssIdNot", "not");return this;};
	this.ssIdNotNull=function(){if(this.proxy)return this.getProxy().ssIdNotNull();this.put("ssIdNot", "not");this.put("ssId", null);return this;};
	this.ssIdNot=function(ssId){if(this.proxy)return this.getProxy().ssIdNot(ssId);this.put("ssIdNot", "not");this.put("ssId", ssId);return this;};
		
	/** and ss_id <= ? */
	this.ssIdMin=function(min){if(this.proxy)return this.getProxy().ssIdMin(min);this.put("ssIdMin", min);return this;};
	/** and ss_id >= ? */
	this.ssIdMax=function(max){if(this.proxy)return this.getProxy().ssIdMax(max);this.put("ssIdMax", max);return this;};
		
		
	this.ssIdIn=function(ids){
		if(this.proxy)return this.getProxy().ssIdIn(ids);  this.put("ssIdIn", ids);return this;
	};	
		 
	
	
	/** 名称 [非空]       **/
	this.ssName=function(ssName){if(this.proxy)return this.getProxy().ssName(ssName);  this.put("ssName", ssName);return this;};
	/** and ss_name is null */
	this.ssNameNull=function(){if(this.proxy)return this.getProxy().ssNameNull();if(this.get("ssNameNot")==null)this.put("ssNameNot", "");this.put("ssName", null);return this;};
	/** not .... */
	this.ssNameNot=function(){if(this.proxy)return this.getProxy().ssNameNot();this.put("ssNameNot", "not");return this;};
	this.ssNameNotNull=function(){if(this.proxy)return this.getProxy().ssNameNotNull();this.put("ssNameNot", "not");this.put("ssName", null);return this;};
	this.ssNameNot=function(ssName){if(this.proxy)return this.getProxy().ssNameNot(ssName);this.put("ssNameNot", "not");this.put("ssName", ssName);return this;};
		
		 
	
	
	/** SQL语句 [非空]       **/
	this.ssSql=function(ssSql){if(this.proxy)return this.getProxy().ssSql(ssSql);  this.put("ssSql", ssSql);return this;};
	/** and ss_sql is null */
	this.ssSqlNull=function(){if(this.proxy)return this.getProxy().ssSqlNull();if(this.get("ssSqlNot")==null)this.put("ssSqlNot", "");this.put("ssSql", null);return this;};
	/** not .... */
	this.ssSqlNot=function(){if(this.proxy)return this.getProxy().ssSqlNot();this.put("ssSqlNot", "not");return this;};
	this.ssSqlNotNull=function(){if(this.proxy)return this.getProxy().ssSqlNotNull();this.put("ssSqlNot", "not");this.put("ssSql", null);return this;};
	this.ssSqlNot=function(ssSql){if(this.proxy)return this.getProxy().ssSqlNot(ssSql);this.put("ssSqlNot", "not");this.put("ssSql", ssSql);return this;};
		
		 
	
	
	/** 时间间隔 [非空]    秒为单位   **/
	this.ssInterval=function(ssInterval){if(this.proxy)return this.getProxy().ssInterval(ssInterval);  this.put("ssInterval", ssInterval);return this;};
	/** and ss_interval is null */
	this.ssIntervalNull=function(){if(this.proxy)return this.getProxy().ssIntervalNull();if(this.get("ssIntervalNot")==null)this.put("ssIntervalNot", "");this.put("ssInterval", null);return this;};
	/** not .... */
	this.ssIntervalNot=function(){if(this.proxy)return this.getProxy().ssIntervalNot();this.put("ssIntervalNot", "not");return this;};
	this.ssIntervalNotNull=function(){if(this.proxy)return this.getProxy().ssIntervalNotNull();this.put("ssIntervalNot", "not");this.put("ssInterval", null);return this;};
	this.ssIntervalNot=function(ssInterval){if(this.proxy)return this.getProxy().ssIntervalNot(ssInterval);this.put("ssIntervalNot", "not");this.put("ssInterval", ssInterval);return this;};
		
	/** and ss_interval <= ? */
	this.ssIntervalMin=function(min){if(this.proxy)return this.getProxy().ssIntervalMin(min);this.put("ssIntervalMin", min);return this;};
	/** and ss_interval >= ? */
	this.ssIntervalMax=function(max){if(this.proxy)return this.getProxy().ssIntervalMax(max);this.put("ssIntervalMax", max);return this;};
		
		
	this.ssIntervalIn=function(ids){
		if(this.proxy)return this.getProxy().ssIntervalIn(ids);  this.put("ssIntervalIn", ids);return this;
	};	
		 
	
	
	/** 上次执行        **/
	this.ssLast=function(ssLast){if(this.proxy)return this.getProxy().ssLast(ssLast);  this.put("ssLast", ssLast);return this;};
	/** and ss_last is null */
	this.ssLastNull=function(){if(this.proxy)return this.getProxy().ssLastNull();if(this.get("ssLastNot")==null)this.put("ssLastNot", "");this.put("ssLast", null);return this;};
	/** not .... */
	this.ssLastNot=function(){if(this.proxy)return this.getProxy().ssLastNot();this.put("ssLastNot", "not");return this;};
	this.ssLastNotNull=function(){if(this.proxy)return this.getProxy().ssLastNotNull();this.put("ssLastNot", "not");this.put("ssLast", null);return this;};
	this.ssLastNot=function(ssLast){if(this.proxy)return this.getProxy().ssLastNot(ssLast);this.put("ssLastNot", "not");this.put("ssLast", ssLast);return this;};
		
	/** and ss_last >= ? */
	this.ssLastStart=function(start){if(this.proxy)return this.getProxy().ssLastStart(start);this.put("ssLastStart", start);return this;};			
	/** and ss_last <= ? */
	this.ssLastEnd=function(end){if(this.proxy)return this.getProxy().ssLastEnd(end);this.put("ssLastEnd", end);return this;};
		
		 
	
	
	/** 修改时间 [非空]       **/
	this.ssUpdateTime=function(ssUpdateTime){if(this.proxy)return this.getProxy().ssUpdateTime(ssUpdateTime);  this.put("ssUpdateTime", ssUpdateTime);return this;};
	/** and ss_update_time is null */
	this.ssUpdateTimeNull=function(){if(this.proxy)return this.getProxy().ssUpdateTimeNull();if(this.get("ssUpdateTimeNot")==null)this.put("ssUpdateTimeNot", "");this.put("ssUpdateTime", null);return this;};
	/** not .... */
	this.ssUpdateTimeNot=function(){if(this.proxy)return this.getProxy().ssUpdateTimeNot();this.put("ssUpdateTimeNot", "not");return this;};
	this.ssUpdateTimeNotNull=function(){if(this.proxy)return this.getProxy().ssUpdateTimeNotNull();this.put("ssUpdateTimeNot", "not");this.put("ssUpdateTime", null);return this;};
	this.ssUpdateTimeNot=function(ssUpdateTime){if(this.proxy)return this.getProxy().ssUpdateTimeNot(ssUpdateTime);this.put("ssUpdateTimeNot", "not");this.put("ssUpdateTime", ssUpdateTime);return this;};
		
	/** and ss_update_time >= ? */
	this.ssUpdateTimeStart=function(start){if(this.proxy)return this.getProxy().ssUpdateTimeStart(start);this.put("ssUpdateTimeStart", start);return this;};			
	/** and ss_update_time <= ? */
	this.ssUpdateTimeEnd=function(end){if(this.proxy)return this.getProxy().ssUpdateTimeEnd(end);this.put("ssUpdateTimeEnd", end);return this;};
		
		 
	
	
	/** 添加时间 [非空]       **/
	this.ssAddTime=function(ssAddTime){if(this.proxy)return this.getProxy().ssAddTime(ssAddTime);  this.put("ssAddTime", ssAddTime);return this;};
	/** and ss_add_time is null */
	this.ssAddTimeNull=function(){if(this.proxy)return this.getProxy().ssAddTimeNull();if(this.get("ssAddTimeNot")==null)this.put("ssAddTimeNot", "");this.put("ssAddTime", null);return this;};
	/** not .... */
	this.ssAddTimeNot=function(){if(this.proxy)return this.getProxy().ssAddTimeNot();this.put("ssAddTimeNot", "not");return this;};
	this.ssAddTimeNotNull=function(){if(this.proxy)return this.getProxy().ssAddTimeNotNull();this.put("ssAddTimeNot", "not");this.put("ssAddTime", null);return this;};
	this.ssAddTimeNot=function(ssAddTime){if(this.proxy)return this.getProxy().ssAddTimeNot(ssAddTime);this.put("ssAddTimeNot", "not");this.put("ssAddTime", ssAddTime);return this;};
		
	/** and ss_add_time >= ? */
	this.ssAddTimeStart=function(start){if(this.proxy)return this.getProxy().ssAddTimeStart(start);this.put("ssAddTimeStart", start);return this;};			
	/** and ss_add_time <= ? */
	this.ssAddTimeEnd=function(end){if(this.proxy)return this.getProxy().ssAddTimeEnd(end);this.put("ssAddTimeEnd", end);return this;};
		
		 
	
	
	/** 状态 [非空]   1:正常 0:无效     **/
	this.ssStatus=function(ssStatus){if(this.proxy)return this.getProxy().ssStatus(ssStatus);  this.put("ssStatus", ssStatus);return this;};
	/** and ss_status is null */
	this.ssStatusNull=function(){if(this.proxy)return this.getProxy().ssStatusNull();if(this.get("ssStatusNot")==null)this.put("ssStatusNot", "");this.put("ssStatus", null);return this;};
	/** not .... */
	this.ssStatusNot=function(){if(this.proxy)return this.getProxy().ssStatusNot();this.put("ssStatusNot", "not");return this;};
	this.ssStatusNotNull=function(){if(this.proxy)return this.getProxy().ssStatusNotNull();this.put("ssStatusNot", "not");this.put("ssStatus", null);return this;};
	this.ssStatusNot=function(ssStatus){if(this.proxy)return this.getProxy().ssStatusNot(ssStatus);this.put("ssStatusNot", "not");this.put("ssStatus", ssStatus);return this;};
		
		
	this.ssStatusIn=function(ids){
		if(this.proxy)return this.getProxy().ssStatusIn(ids);  this.put("ssStatusIn", ids);return this;
	};	
		 
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有定时SQL **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/systematic/srvsql.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取定时SQL分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/systematic/srvsql.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取定时SQL **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/systematic/srvsql.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

SrvSql.get = function(id){
	var protocol = ux.ajax("/admin/systematic/srvsql.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.srvSql;
	return null;
}

SrvSql.where = new SrvSql.Where(0,true);